package gui.helper;

import java.awt.Color;

import javax.swing.JLabel;

public class CorrectnessTester {

	/**
	 * @param errorVariable
	 *            boolean variable indicating if all information is valid
	 * @param truthValue
	 *            true if error exists, false if information is correct
	 * @param toModify
	 *            JLabel of which color has to be modified in case of error
	 * @return new value of the error variable
	 */
	public static boolean testCorrectness(boolean errorVariable, boolean truthValue, JLabel toModify) {
		if (truthValue) {
			toModify.setForeground(Color.red);
			errorVariable = true;
		} else {
			toModify.setForeground(Color.black);
		}
		return errorVariable;
	}

}
